package com.hmall.user.util;

/**
 * @Auth: Yang
 * @Desc: 线程设置用户ID工具类
 * @Date: 2023/4/20 17:26
 */
public class UserHolder {
    private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setUser(Long userId) {
        threadLocal.set(userId);
    }

    public static Long getUser() {
        return threadLocal.get();
    }

    public static void removeUser() {
        threadLocal.remove();
    }



}